package com.sunset.util;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

import com.sunset.match.ColorKMeans;
import com.sunset.match.Oritenation;
import com.sunset.match.PlateNumberGroup;
import com.sunset.match.RecEachCharInMinDis;
import com.sunset.match.SegInEachChar;

public class Plateocr {

    public static String recPlate(String bitstr){

        Bitmap bitmap = null;
        Bitmap curbitmap = null;
        String cph = null;

        Bitmap[] bitmaps = null;

        BitmapFactory.Options options = new BitmapFactory.Options();
        options.inPreferredConfig = Bitmap.Config.ARGB_8888;
        bitmap = BitmapFactory.decodeFile("/sdcard/xjhxcp/"+ bitstr +".jpg", options);
        curbitmap = ColorKMeans.Math(bitmap);
        curbitmap = Oritenation.Math(curbitmap, bitmap);

        if (PlateNumberGroup.AlreadyChecked) {
            bitmaps = SegInEachChar.Math(curbitmap);
            Bitmap Bmp = RecEachCharInMinDis.ClearSmall(bitmaps[2]);
            Bmp = RecEachCharInMinDis.GetRegion(Bmp);
            Bmp = RecEachCharInMinDis.Zoom(Bmp);
        }
        if (PlateNumberGroup.AlreadyChecked) {
            cph = RecEachCharInMinDis.Math(bitmaps);
        }
        return cph;
    }

}
